<include file="layout/header" />
<!-- Right side column. Contains the navbar and content of the page -->
<script language="javascript">
    /*
     * 方法作用：导出excel
     */
    function exportExcel(){
        var str = "__CONTROLLER__/toExcel";
        $("#formInvoiceList").attr("action", str);
        $("#formInvoiceList").submit();
    }
    /*
     * 方法作用：根据公司名称查询
     */
    function searchInvoice(){
        var str = "__CONTROLLER__/recordSearch";
        $("#formInvoiceList").attr("action", str);
        $("#formInvoiceList").submit();
    }
    
    /**
     * 方法作用：根据发票记录查询关联的合同
     */
     function unionContract($cid){
         var str = "__CONTROLLER__/invoiceUnionContract/cid/"+$cid;
         $("#formInvoiceList").attr("action", str);
         $("#formInvoiceList").submit();    	
    }


</script>
<aside class="right-side">
    <section class="content-header">
        <h1>
            发票管理
            <small>Invoice Manager</small>
        </h1>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-body table-responsive">
                        <button class="btn btn-app btn-sm" onclick="exportExcel()">导出</button>
                        <form method="post" action="" role="form" id="formInvoiceList">
                            <input type="text" id="p_name" name="p_name" class="form-control" value="{$p_name}" placeholder="请输入查找的单位或公司名称...">                            
                            <input type="button" class="btn btn-primary btn-sm" onclick="searchInvoice()" value="查找"/>
                        </form>
                        <table id="example2" class="table table-bordered table-hover text-left">
                            <thead>
                            <tr>
                                <th class="text-center">序号</th>
                                <th class="text-center">客户名称</th>
                                <th class="text-center">开票日期</th>
                                <th class="text-center">开票金额</th>
                                <th class="text-center">发票编号</th>
                                <th class="text-center">合同数量</th>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="invoices" id="invoice">
                                <tr>
                                    <td class="text-center">{$i}</td>
                                    <td><a href='__CONTROLLER__/detail/id/{$invoice.id}'>{$invoice.p_name}</a></td>
                                    <td>{$invoice.create_date}</td>
                                    <td>{$invoice.i_price}</td>
                                    <td>{$invoice.i_no}</td>
                                    <td><a href='javascript:unionContract("{$invoice.c_id}")'>{$invoice.c_num}</a></td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                        <div class="text-center pagelist">
                            　　{$page}
                        </div>
                    </div><!-- /.box-body -->
                </div><!-- /.box -->
            </div>
        </div>
    </section>
</aside><!-- /.right-side -->
<include file="layout/footer" />